github ssh 멀티 계정

마지막 수정일: 2024. 12. 19.

Overview

github ssh 설정 시 비밀번호 설정 안 하고 여러 계정 등록하는 방법

1. ssh 설정

BASH
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

2. ssh github 등록

BASH
cat ~/.ssh/id_rsa.pub

3. ssh config file 등록(~/.ssh/config)

BASH
Host github.com-cencivic
    HostName github.com
    AddKeysToAgent yes
    UseKeychain yes
    User git
    IdentityFile ~/.ssh/id_rsa_cencivic

Host github.com-linkive
    HostName github.com
    AddKeysToAgent yes
    UseKeychain yes
    User git
    IdentityFile ~/.ssh/id_rsa_linkive

4. ssh key 에이전트 등록

BASH
ssh-add ~/.ssh/id_rsa_cencivic
or 
ssh-add --apple-use-keychain ~/.ssh/id_rsa_cencivic # login whenever login,out

5. test

BASH
ssh -T git@github.com-cencivic